import { http } from "@/utils/http";

interface GoodsList {
  code: number;
  message: string;
  data?: any;
  total?: number;
}

/** 获取商品列表*/
export const getGoodsList = (params?: object) => {
  return http.request<GoodsList>("get", "/api/goods/list", { params });
};
/** 获取商品详情*/
export const getGoodsDetail = (data?: object) => {
  return http.request<GoodsList>("post", "/api/goods/detail", { data });
};
/** 添加商品*/
export const addGoods = (data?: object) => {
  return http.request<GoodsList>("post", "/api/goods/add", { data });
};
/** 修改商品*/
export const updateGoods = (data?: object) => {
  return http.request<GoodsList>("post", "/api/goods/update", { data });
};
/** 更新商品状态*/
export const updateGoodsStatus = (data?: object) => {
  return http.request<GoodsList>("post", "/api/goods/update-status", { data });
};
/** 删除商品 - 支持单个ID或ID数组*/
export const delGoods = (data?: object) => {
  return http.request<GoodsList>("post", "/api/goods/del", { data });
};
